package com.atguigu.gulimall.search.utils.others;

import java.util.*;

public class Show {
    public static void doShow(Set<Integer> set) {
        Iterator<Integer> iterator = set.iterator();
        System.out.print("{");
        while (iterator.hasNext()) {
            System.out.print(iterator.next() + " ,");
        }
        System.out.print("}");
    }

    public static void doShow(Set<Object> set, Object obj) {
        Iterator<Object> iterator = set.iterator();
        System.out.print("{");
        while (iterator.hasNext()) {
            System.out.print(iterator.next() + " ,");
        }
        System.out.print("}");
    }

    public static void doShow(String[] s) {
        String res = Arrays.toString(s);
        res = res.replace('[', '{');
        res = res.replace(']', '}');
        System.out.println(res);
    }

    public static void doShow(Map map) throws NullPointerException {
        System.out.println("{");
        for (Object ma : map.entrySet()) {
            if (((Map.Entry) ma).getValue() != null && ((Map.Entry) ma).getValue().getClass().toString().equals("class java.util.ArrayList")) {
                System.out.println(((Map.Entry) ma).getKey() + ": ");
                List<Map> tempM = (List<Map>) ((Map.Entry) ma).getValue();
                for (Map temp : tempM) {
                    System.out.println("{");
                    doShow(temp);
                    System.out.println("}");
                }
            } else {
                System.out.println(((Map.Entry) ma).getKey() + ": " + ((Map.Entry) ma).getValue());
            }
        }
        System.out.println("}");
    }

    public static void doShow(Map map, String type) throws NullPointerException {
        if (type.equals("char:list:string")) {
            doShow(map, '0');
        }
    }

    private static void doShow(Map<Character, List<String>> map, char c) {
        System.out.println("{");
        for (Object ma : map.entrySet()) {
            System.out.print(((Map.Entry) ma).getKey() + ": ");
            System.out.print(" { ");
            List<String> tempM = (List<String>) ((Map.Entry) ma).getValue();
            for (String s : tempM) {
                System.out.print(s + " ,");
            }
            System.out.println("}");
        }
        System.out.println("}");

    }

    public static void doShow(int[][] nums) {
        if (nums == null) {
            System.out.println("null");
            return;
        }
        for (int[] i : nums) {
            doShow(i);
        }
        System.out.println();
    }

    public static void doShow(double[] nums) {
        System.out.print("{");
        for (int i=0;i<nums.length;i++) {
            System.out.print(nums[i]);
            if(i<nums.length-1) System.out.print(" , ");
        }
        System.out.println("}");
    }

    public static void doShow(int[] nums) {
        doShow(Arrayss.IntToStr(nums));
    }

    public static void doShow(Integer[] nums) {
        doShow(Arrayss.IntToStr(nums));
    }

    public static void doShow(List<Object> list) {
        System.out.print("[ ");
        for (Object s : list) {
            System.out.print(s.toString() + " ");
        }
        System.out.println(" ]");
    }


    public static void doShow(List<String> list, String i) {
        System.out.print("[");
        for (int j = 0; j < list.size(); j++) {
            System.out.print(list.get(j));
            if (j < list.size() - 1) {
                System.out.print(" , ");
            }
        }
        System.out.print("]");
    }

    public static void doShow(List<List<String>> lists, String i1, String ii2) {
        System.out.println("[");
        for (List<String> s : lists) {
            doShow(s, "");
        }
        System.out.println("]");
    }


    public static void doShow(List<Integer> list, Integer i) {
        System.out.print("[ ");
        for (int j = 0; j < list.size(); j++) {
            System.out.print(list.get(j));
            if (j < list.size() - 1) {
                System.out.print(",");
            }
        }
        System.out.print(" ] ");
    }

    public static void doShow(List<List<Integer>> lists, Integer i1, Integer ii2) {
        System.out.print("[ ");
        for (int i = 0; i < lists.size(); i++) {
            doShow(lists.get(i), 0);
            if (i < lists.size() - 1) {
                System.out.print(",");
            }
        }
        System.out.println("]");
    }

    public static void doShow(List<Integer[]> lists, Integer i1, int ii2) {
        System.out.print("[ ");
        for (Integer[] integers : lists) {
            System.out.print("[ ");
            doShow(integers);
            System.out.print("], ");
        }
        System.out.println("]");
    }
//    public static void doShow(List<Integer> list){
//        doShow((String[]) list.toArray());
//    }


    public static void doShow(char[] chars) {
        System.out.print("{");
        for (char i : chars) {
            System.out.print(i + " ,");
        }
        System.out.println("}");
    }

    public static void doShow(char[][] chars) {
        for (char[] i : chars) {
            for (char j : i) {
                System.out.print(j + " ,");
            }
            System.out.println();
        }
    }

    public static void doShow(String[][] s) {
        System.out.println("{");
        for (String[] ss : s) {
            doShow(ss);
        }
        System.out.println("}");
    }

    public static void doShow(boolean[][] b) {
        System.out.println();
        for (boolean[] booleans : b) {
            for (boolean bb : booleans) {
                System.out.print(bb + " ");
            }
            System.out.println();
        }
        System.out.println();
    }

    public static void doShow(boolean[] b) {
        System.out.println();
        for (boolean bb : b) {
            System.out.print(bb + " ");
        }
        System.out.println();
    }

    public static void doShowList(List<Integer> list) {
        for (Integer i : list) {
            System.out.print(i + " ");
        }
        System.out.println();
    }

    public static void doShowList(List<List<Integer>> list, boolean b) {
        for (List<Integer> i : list) {
            doShowList(i);
        }
        System.out.println();
    }
}
